<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/js/vue.js"></script>
</head>
<body>
    <!-- 在body代码中,li中的book表示数组中的每一项元素,index表示当前元素的索引,books是data数据中的books源数组 -->
    <div id="app">
        <ul>
            <li v-for="(book,index) in books">{{index}}-{{book.title}}</li>
        </ul>
    </div>
</body>
<script>

    var vm=new Vue({
        el:'#app',
        data:{
            books:[
                {title:"Vue 无难事"},
                {title:"VC++深入详情"},
                {title:"Servlet/JSP深入详解"}
            ]
        }
    })
</script>
</html>